Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function GetObject Lib "gdi32" Alias "GetObjectA" (ByVal hObject As Long, ByVal nCount As Long, lpObject As Any) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
' USER32
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function LoadImage Lib "user32" Alias "LoadImageA" (ByVal hInst As Long, ByVal lpsz As String, ByVal un1 As Long, ByVal n1 As Long, ByVal n2 As Long, ByVal un2 As Long) As Long
Private Declare Function StretchBlt Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long
Private Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long
Const ResolutionX = 640 ' Width for the display mode
Const ResolutionY = 480 ' Height for the display mode
Dim dd As DirectDraw2 ' DirectDraw object
Dim ddsdFront As DDSURFACEDESC ' Front surface description
Dim ddsFront As DirectDrawSurface2 ' Front buffer
Dim ddsBack As DirectDrawSurface2 ' Back buffer
Dim aDDS As DirectDrawSurface2 ' Images to blit
Dim tDDS As DirectDrawSurface2 ' tiles to blit
Dim ddCaps As DDSCAPS ' Capabilities for search
Dim fx As DDBLTFX
'hold the sprites
Dim spnx%(40), spny%(40), spnw%(40), spnh%(40), spnox%(40), spnoy%(40)
Dim mode% 'mode% is the current behaviour
Dim anim% 'amount through the given behaviour animation
Dim animshift% 'flag to indicate if blocks should be pushed during anim
'dim sprite behaviour guff
Dim bname$(30) 'name of behaviour (arbitrary 30 behaviour limit)
Dim bcells%(30) 'number of cells in the behaviour
Dim bchar%(30, 30) '30 behaviours, with max 30 cells in the anim
Dim bxo%(30, 30) 'x offset
Dim byo%(30, 30) 'y offset
'now the block array x and y in pixels
Dim blockx%(30) 'up to 30 blocks on a map
Dim blocky%(30)
Dim blockcell%(30)
Dim blockmode%(30) '0=none, 1=left, 2=right, 3=fall
Dim blockcount% 'number of blocks on this level
Dim level%
'hold the map
Dim map(40, 6) As Integer '40 wide, 6 high
Dim mapl%, mapv% 'left margin
' Loads a bitmap in a DirectDraw surface
Private Function CreateDDSFromBitmap(dd As DirectDraw2, ByVal strFile As String) As DirectDrawSurface2
Dim hbm As Long ' Handle on bitmap
Dim bm As BITMAP ' Bitmap header
Dim ddsd As DDSURFACEDESC ' Surface description
Dim dds As DirectDrawSurface2 ' Created surface
Dim hdcImage As Long ' Handle on image
Dim mhdc As Long ' Handle on surface context
Dim clr As Long 'hold the colour top left to be made transparent